<div class="wrapper">
        <div class="category-menu">
            
            {{-- 遍历根分类 --}}
            @php 
                $n = 0;   //用于限制遍历根分类的数量
            @endphp

            @foreach($sortList as $v)
                @if($n < 4)   {{-- 此处控制遍历根分类的数量 --}}
                <div class="f-item" style="padding:13px 0 5px 15px; margin:0px 0 0 5px;">  {{-- 此处的style属性是我自己改的,为的是让切换选项卡时看起来更顺滑,如果因此出现其他的样式问题,请删除 --}}
                    <div class="f-tit"><a href="{{asset('goodslist?sortid='.$v['id'])}}">{{$v['sname']}}</a></div>
                    <div class="f-list">
                        
                        {{-- 遍历二级 --}}
                        @php 
                            $m = 0;  
                        @endphp
                        
                        {{-- 如果有二级分类,则遍历出来 --}}
                        @if(isset($v['subSort']))
                            @foreach($v['subSort'] as $subSort)

                                {{-- 遍历二级分类名字 --}}
                                <a href="{{asset('goodslist?sortid='.$subSort['id'])}}">{{$subSort['sname']}}</a>
                                
                                @if(isset($subSort['thirdSort']))
                                    
                                    @php 
                                        $m++;    //如果有三级分类,则加1,用于判断是否要显示三级分类的隐藏版面
                                    @endphp

                                @endif

                            @endforeach
                        @endif

                    </div>
                    
                    @if($m > 0)
                        
                        <div class="c-box">
                            <div class="c-list">
                                
                                @if(isset($v['subSort']))

                                    @foreach($v['subSort'] as $subSort)
                                    <div class="dl">
                                        <div class="dt">{{$subSort['sname']}}</div>
                                        <div class="dd">
                                            @if(isset($subSort['thirdSort']))
                                                @foreach($subSort['thirdSort'] as $thirdSort)
                                                    
                                                    {{-- 遍历三级分类名字 --}}
                                                    <a href="{{asset('goodslist?sortid='.$thirdSort['id'])}}">{{$thirdSort['sname']}}</a>

                                                @endforeach
                                            @endif
                                        </div>
                                    </div>
                                    @endforeach
                                @endif

                            </div>

                            <!-- 广告图片 -->
                            <!-- <a class="b-img">
                                <img src="{{asset('Home/uploads/46.jpg')}}" alt="" />
                            </a> -->
                        </div>
                    @endif
                </div>
                @endif

                @php
                    $n++;  //控制显示根分类
                @endphp
            @endforeach

        </div>

        <!-- 轮播图 -->
        <div class="home-banner">
            @foreach($carousels as $v)
                <a href="{{asset('/goods-detail/'.$v->gid)}}"><img src="{{asset($v->path)}}" alt="" /></a>
            @endforeach
        </div>
        <div class="home-banner-ad">
            @foreach($asidePromotion as $v)
                <a href="{{asset('/goods-detail/'.$v->gid)}}"><img src="{{asset($v->path)}}" alt="" /></a>
            @endforeach
        </div>
    </div>